var param = {};

$(function() {
	
});


function findElderPayList() {
	var beHospitalId = $('input:radio[name="elderId"]:checked').attr('beHospitalId');
	elderPayRecord_findInventory(beHospitalId);
}

function elderPayRecord_findInventory(beHospitalId) {
	if($('#vue_vm_list_inventory div').length==0) {return;}
	$('#vue_vm_list_inventory div').hide();

	find_basic_by_json(path+'/elderPayRecord/findByBeHospitalId', {beHospitalId: beHospitalId}, function(response) {
		$('#vue_vm_list_inventory').html(gl_vue_vm_list_inventory_html);
		
		param.beHospitalId = response.data[0].beHospitalId;
		param.beNumber = response.data[0].elderBeHospitalForm.beNumber;
		param.beDate = response.data[0].elderBeHospitalForm.beDate;
		param.name = response.data[0].elderBeHospitalForm.elderForm.name;
		param.sex = response.data[0].elderBeHospitalForm.elderForm.sex;
		param.arreaForms = response.data[0].arreaForms;
		param.payRecordFroms = response.data[0].payRecordFroms;
		
		new Vue({
			el: '#vue_vm_list_inventory',
			data: {
				todos: response.data
			},
			methods: {
				openTotalPage:function() {
					openTotalPageByDay(beHospitalId, yearMonthDay);
				},
				openPrintPage:function(paperType) {
					openPrintPage_out(beHospitalId, paperType);
				},
				getElderPayRecordTotalMoney:function(forms) {
					var totalMoney = 0;
					if(forms) {
						for(var i=0; i<forms.length; i++) {
                            if(forms[i].payWay==3){//如果是vip卡扣费
                                continue;
                            }
							totalMoney += forms[i].payMoney;
						}
					}
					
					return totalMoney;
				},
				getElderArrearageTotalMoney:function(forms) {
					var totalMoney = 0;
					
					if(forms) {
						for(var i=0; i<forms.length; i++) {
							totalMoney += forms[i].arrearageMoney;
						}
					}
					
					return totalMoney;
				}
			}
		});
		
		$('#vue_vm_list_inventory div').show();
	});
}

function openPrintPage() {
}